﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using KOPLibrary.TemplateManagement;
using KOPLibrary.PreferenceManagement;

namespace KOPLibrary.Forms
{
    public partial class StartupForm : Form
    {
        private TemplateType type;
        public StartupForm()
        {
            InitializeComponent();
        }


        public static void CheckExecute(TemplateType type)
        {
            string showed = PreferenceManager.ReadKey("StartupDisplayed", type);
            if (string.IsNullOrEmpty(showed))
            {
                StartupForm form = new StartupForm();
                form.Execute(type);
            }

        }

        private void Execute(TemplateType type)
        {
            this.type = type;
            Show();
        }

        private void StartupForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (chkOK.Checked)
                PreferenceManager.SaveKeyToTypeRoot("StartupDisplayed", "1", type);
        }

        private void chkOK_CheckedChanged(object sender, EventArgs e)
        {
            if (chkOK.Checked)
                Close();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Util.GoToOfficialWebPage();
        }
    }
}
